package com.xcity.pomelo.response;

import com.xcity.game.common.ItemResponse;
import com.xcity.game.task.Task;
import com.xcity.game.task.TaskCondition;
import com.xcity.game.task.TaskTemplate;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class TaskResponse extends Response {

	private byte type;
	private int id;
	private String name;
	private String desc;
	private int exp;
	private int gold;
	private int stone;
	private int honor;
	private ItemResponse[] items;
	private int state;
	private TaskCondition cond; // 完成任务的条件
	
	@PomeloMessage(type = Message.Type.RESPONSE)
	public static class PureResponse extends Response {
		private int id;
		public PureResponse(int serial, int id) {
			super(serial);
			this.id = id;
		}
		public int getId() {
			return id;
		}
		public void setId(int id) {
			this.id = id;
		}
	}
	
	public TaskResponse(int serial, Task task) {
		super(serial);
		TaskTemplate template = task.getTemplate();
		this.type = template.getType();
		this.id = task.getId();
		this.name = template.getName();
		this.desc = template.getDesc();
		this.exp = template.getExp();
		this.gold = template.getGold();
		this.stone = template.getStone();
		this.honor = template.getHonor();
		this.items = template.getItemObjs();
		this.state = task.getState().ordinal();
		this.cond = TaskCondition.create(template);
	}

	public byte getType() {
		return type;
	}

	public void setType(byte type) {
		this.type = type;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public int getExp() {
		return exp;
	}

	public void setExp(int exp) {
		this.exp = exp;
	}

	public int getGold() {
		return gold;
	}

	public void setGold(int gold) {
		this.gold = gold;
	}

	public int getStone() {
		return stone;
	}

	public void setStone(int stone) {
		this.stone = stone;
	}

	public int getHonor() {
		return honor;
	}

	public void setHonor(int honor) {
		this.honor = honor;
	}

	public ItemResponse[] getItems() {
		return items;
	}

	public void setItems(ItemResponse[] items) {
		this.items = items;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public TaskCondition getCond() {
		return cond;
	}

	public void setCond(TaskCondition cond) {
		this.cond = cond;
	}
	
}
